package com.example.mybatis.multdb.controller;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.mybatis.multdb.mapper1.UserMapper1;
import com.example.mybatis.multdb.mapper2.UserMapper2;

/**
 * Project:spring-boot-mybatis-multdb
 * <p>
 * Title:UserController.java
 * <p>
 * Description:
 * <p>
 * Copyrigth:Jiang Software LTD.co Copyright (c) 2022
 * <p>
 * 
 * @version 1.0
 * @since 1.8
 * @author jiang
 * @history 2022 jiang create
 */
@Controller
public class UserController {
	@Resource
	UserMapper1 userMapper1;

	@Resource
	UserMapper2 userMapper2;

	@RequestMapping("/getUsers")
	@ResponseBody
	public String getUsers() {
		List<Map<String, Object>> users1 = userMapper1.getUsers();// 数据源1
		List<Map<String, Object>> users2 = userMapper2.getUsers();// 数据源2
		System.out.println(users1);
		System.out.println(users2);
		return "这是双数据源案例";
	}
}
